home *** CD-ROM | disk | FTP | other *** search
- BEGIN {
- # Sorry, but most awk's are not able to deal with double quotes...
- doublequote=sprintf("%c",34);
- #{{{}}}
- # {{{ print auto-gen-mark
- print("/* This file is generated automatically by awk -f tok2h.awk */\n/* containing the token-name-list for viewrc */")
- # }}}
- printf("char const * const dec[]=\n")
- print(" { "doublequote"O_NOP"doublequote",")
- # {{{ init fixed cmd arg range
- cmd_range=8
- # }}}
- }
- #{{{ set fixed cmd arg range
- /^#define +FIXED_COMMAND_RANGE/ {
- cmd_range=$3
- }
- #}}}
- #{{{ set types for command and fixed command
- $3=="COM" || $3=="COM_I" || $3=="COM_II" || $3=="COM_P" || $3=="COM_IP" || $3=="COM_IIP" || $3=="COM_C" { typ=$3;fix_typ="" }
- $3=="COM_A" { typ="COM_A";fix_typ="COM" }
- $3=="COM_ID" { typ="COM_II";fix_typ="COM_I" }
- $3=="COM_D" { typ="COM_I";fix_typ="COM" }
- #}}}
- #{{{ add command
- substr($1,1,1)!="#" && $3!="OCL-KEY" && $3!="OPP-KEY" {
- if (fix_typ!="") {
- for (i=cmd_range;i>0;i--) print(" "doublequote $1"_M"i doublequote",")
- for (i=0;i<=cmd_range;i++) print(" "doublequote $1"_"i doublequote",")
- }
- print(" "doublequote $1 doublequote",")
- }
- #}}}
- END {
- print(" "doublequote doublequote"\n };")
- }
-